/**
 * pharma-model - 9 janv. 2011 guillaume
 */
package org.bspv.pharma.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Version;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.bspv.pharma.common.constant.Constants;
import org.hibernate.annotations.NaturalId;

/**
 * @author guillaume
 */
@Entity
@Table(name = "PLACE")
public class Place implements Serializable {

    /**
     * serialVersionUID.
     */
    private static final long serialVersionUID = 4177064715957125685L;
    /**
     * Identifiant de l'emplacement.
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    /**
     * Code de l'emplacement.
     */
    @NaturalId
    @NotNull
    @Size(max = Constants.CONSTRAINT_CODE_SIZE)
    private String code;
    /**
     * Libellé de l'emplacement.
     */
    @Size(max = Constants.CONSTRAINT_LABEL_SIZE)
    private String label;
    /**
     * Description de l'emplacement.
     */
    @Size(max = Constants.CONSTRAINT_DESCRIPTION_SIZE)
    private String description;
    /**
     * Centre de secours pour cet emplacement.
     */
    @NotNull
    @ManyToOne
    private FireStation fireStation;
    /**
     * Emplacement parent.
     */
    @ManyToOne
    private Place parent;
    /**
     * Date à partir de laquelle l'emplacement est déprécié.
     */
    private Date deprecated;
    /**
     * Date à partir de laquelle l'emplacement est obsolète.
     */
    private Date obsolete;
    /**
     * Borne inférieure (pour représentation intervallaire).
     */
    @NotNull
    private Integer lowerMarkup = 0;
    /**
     * Borne supérieure (pour représentation intervallaire).
     */
    @NotNull
    private Integer upperMarkup = 0;
    /**
     * Cet emplacement est il fonctionnel (par opposition à un emplacement de stockage).
     */
    @NotNull
    private Boolean functionalPlace;
    /**
     * Commentaire sur l'emplacement.
     */
    @Size(max = Constants.CONSTRAINT_COMMENT_SIZE)
    private String comment;
    /**
     * Numéro de version.
     */
    @Version
    private Integer version;

    /**
     * @return the id
     */
    public final Long getId() {
        return id;
    }

    /**
     * @param id
     *            the id to set
     */
    public final void setId(final Long id) {
        this.id = id;
    }

    /**
     * @return the code
     */
    public final String getCode() {
        return code;
    }

    /**
     * @param code
     *            the code to set
     */
    public final void setCode(final String code) {
        this.code = code;
    }

    /**
     * @return the label
     */
    public final String getLabel() {
        return label;
    }

    /**
     * @param label
     *            the label to set
     */
    public final void setLabel(final String label) {
        this.label = label;
    }

    /**
     * @return the description
     */
    public final String getDescription() {
        return description;
    }

    /**
     * @param description
     *            the description to set
     */
    public final void setDescription(final String description) {
        this.description = description;
    }

    /**
     * @return the fireStation
     */
    public final FireStation getFireStation() {
        return fireStation;
    }

    /**
     * @param fireStation
     *            the fireStation to set
     */
    public final void setFireStation(final FireStation fireStation) {
        this.fireStation = fireStation;
    }

    /**
     * @return the parent
     */
    public final Place getParent() {
        return parent;
    }

    /**
     * @param parent
     *            the parent to set
     */
    public final void setParent(final Place parent) {
        this.parent = parent;
    }

    /**
     * @return the deprecated
     */
    public final Date getDeprecated() {
        return deprecated;
    }

    /**
     * @param deprecated
     *            the deprecated to set
     */
    public final void setDeprecated(final Date deprecated) {
        this.deprecated = deprecated;
    }

    /**
     * @return the obsolete
     */
    public final Date getObsolete() {
        return obsolete;
    }

    /**
     * @param obsolete
     *            the obsolete to set
     */
    public final void setObsolete(final Date obsolete) {
        this.obsolete = obsolete;
    }

    /**
     * @return the lowerMarkup
     */
    public final Integer getLowerMarkup() {
        return lowerMarkup;
    }

    /**
     * @param lowerMarkup
     *            the lowerMarkup to set
     */
    public final void setLowerMarkup(final Integer lowerMarkup) {
        this.lowerMarkup = lowerMarkup;
    }

    /**
     * @return the upperMarkup
     */
    public final Integer getUpperMarkup() {
        return upperMarkup;
    }

    /**
     * @param upperMarkup
     *            the upperMarkup to set
     */
    public final void setUpperMarkup(final Integer upperMarkup) {
        this.upperMarkup = upperMarkup;
    }

    /**
     * @return the functionalPlace
     */
    public final Boolean getFunctionalPlace() {
        return functionalPlace;
    }

    /**
     * @param functionalPlace
     *            the functionalPlace to set
     */
    public final void setFunctionalPlace(final Boolean functionalPlace) {
        this.functionalPlace = functionalPlace;
    }

    /**
     * @return the comment
     */
    public final String getComment() {
        return comment;
    }

    /**
     * @param comment
     *            the comment to set
     */
    public final void setComment(final String comment) {
        this.comment = comment;
    }

    /**
     * @return the version
     */
    public final Integer getVersion() {
        return version;
    }

    /**
     * @param version
     *            the version to set
     */
    public final void setVersion(final Integer version) {
        this.version = version;
    }

}
